﻿@model CustomerModel

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewData["Title"] = "客户资料列表";
}

<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        Data Tables
        <small>advanced tables</small>
    </h1>
    <ol class="breadcrumb">
        <li><a asp-controller="Home" asp-action="Index"><i class="fa fa-dashboard"></i>首页</a></li>
        <li><a asp-controller="Customers" asp-action="Index">客户管理</a></li>
        <li class="active">客户列表</li>
    </ol>
</section>
<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box box-info">
                <form asp-controller="Customers" asp-action="Index" method="get">
                    <div class="box-header">
                        <h3 class="box-title">@ViewData["Title"]</h3>
                        <div class="box-tools pull-right">
                            <a class="btn btn-block btn-primary" asp-action="Create"><i class="fa fa-user-plus"></i> 新建客户</a>
                        </div>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body">
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="table-header">
                                    <label class="col-sm-1 control-label">客户姓名：</label>
                                    <div class="col-sm-2 control-div">
                                        <input class="form-control" name="customerName" placeholder="请输入客户姓名查询...">
                                    </div>
                                    <div class="col-sm-1 control-div">
                                        <button type="submit" id="btnSearch" class="btn btn-block btn-primary"><i class="fa fa-search"></i>&nbsp;搜索</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <table id="example1" class="table table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>
                                        #
                                    </th>
                                    <th>
                                        @Html.DisplayNameFor(model => model.CustomerList[0].RealName)
                                    </th>
                                    <th>
                                        @Html.DisplayNameFor(model => model.CustomerList[0].Sex)
                                    </th>
                                    <th>
                                        @Html.DisplayNameFor(model => model.CustomerList[0].Birthday)
                                    </th>
                                    <th>
                                        @Html.DisplayNameFor(model => model.CustomerList[0].PhoneNumber)
                                    </th>
                                    <th>
                                        @Html.DisplayNameFor(model => model.CustomerList[0].ContactNumber)
                                    </th>
                                    <th>
                                        @Html.DisplayNameFor(model => model.CustomerList[0].CutomerState)
                                    </th>
                                    <th>
                                        @Html.DisplayNameFor(model => model.CustomerList[0].CreateTime)
                                    </th>
                                    <th>
                                        @Html.DisplayNameFor(model => model.CustomerList[0].UpdateTime)
                                    </th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                @foreach (var item in Model.CustomerList)
                                {
                                    <tr>
                                        <td>
                                            1
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.RealName)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.Sex)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.Birthday)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.PhoneNumber)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.ContactNumber)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.CutomerState)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.CreateTime)
                                        </td>
                                        <td>
                                            @Html.DisplayFor(modelItem => item.UpdateTime)
                                        </td>
                                        <td>
                                            <a asp-action="Edit" asp-route-id="@item.Id">编辑</a> |
                                            <a asp-action="Details" asp-route-id="@item.Id">详情</a> |
                                            <a asp-action="Delete" asp-route-id="@item.Id">删除</a>
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                        <div class="my-pages">
                            @Html.Raw(Html.AdminPager(Model.PageModel))
                        </div>
                    </div>
                    <!-- /.box-body -->
                </form>
            </div>
            <!-- /.box -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
</section>
<!-- /.content -->
@section scripts{
    <script type="text/javascript">

        //表单提交操作
        function doPostBack(action) {
            var from = $("form:first");
            if (action != "") {
                from.prop("action", action);
            }
            from.get(0).submit();
        };

        $(function () {
            //搜索按钮
            //$("#btnSearch").click(function () {
            //    doPostBack("");
            //    //return false;
            //    console.log("搜索");
            //});

        })
    </script>
}
